﻿using FreeDream.IService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;

namespace FreeDream.WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TestDemoController : ControllerBase
    {
        private string currentUserId => HttpContext.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
        public IAService _aService;
        public IBService _bService;
        public TestDemoController(IAService aService, IBService bService)
        {
            _aService = aService;
            _bService = bService;
        }

        /// <summary>
        /// 获取A值
        /// </summary>
        /// <param name="input">参数1</param>
        /// <returns></returns>
        [HttpGet, Route("GetAAll")]
        public string GetA(string input)
        {
            var res = _aService.GetA();
            //Serilog.Log.Error($"Address...{DateTime.Now}");
            return $"{input},{res}";
        }

        /// <summary>
        /// 获取B值
        /// </summary>
        /// <param name="input">参数1</param>
        /// <returns></returns>
        [HttpGet, Route("GetBAll")]
        public string GetB(string input)
        {
            var res = _bService.GetB(input);
            return $"{res}";
        }
    }
}
